<?php

class TestController extends BaseController {
    
    //protected $layout = 'site.default';
     
    public function getIndex()
    {
                    
            $user = new User; 
            
            $input = array 
                    (
                        'email' => 'asd@gmail.com',
                        'username' => 'mtigdemir',
                        'password' => '12345678',
                        'password_confirmation' => '12345678',
                    );
            
            if($user->validate($input))
            {
                echo 'burda2';
                echo $user;
            }else {
                echo 'burda';
                echo $user->errors;
            }
    }
    
     function get_url_contents($url) {
            $crl = curl_init();

            curl_setopt($crl, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
            curl_setopt($crl, CURLOPT_URL, $url);
            curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5);

            $ret = curl_exec($crl);
            curl_close($crl);
            return $ret;
     }
    public function getSerciko() {

        $json = $this->get_url_contents('http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=sausages');

        $data = json_decode($json);

        foreach ($data->responseData->results as $result) {
            $results[] = array('url' => $result->url, 'alt' => $result->title);
            
            echo '<img src="'.$result->url.'" />';
        }

        print_r($results);
    }
    
    public function getTable() {
        Cloudinary::config(array( 
            "cloud_name" => "sample", 
            "api_key" => "874837483274837", 
            "api_secret" => "a676b67565c6767a6767d6767f676fe1" 
          ));
        Cloudinary\Uploader::upload("/home/my_image.jpg");
        
        return View::make('ajax.datatable');
    }
    
    
    public function getA(){
       $gg = new GoogleImages();
       $gg->get_Images('deniz akkaya');
    }
}